﻿using System;
using System.Collections.Generic;
using System.Timers;

namespace AvantGameMachine.Timers
{
    public class Tempo
    {
        private Timer myTimer = new Timer();
        private bool ellapsed = false;

        internal Tempo(int _interval,bool _autoreset)
        {
            myTimer = new Timer((double)_interval);
            myTimer.Elapsed +=new ElapsedEventHandler(myTimer_Elapsed);
            myTimer.AutoReset = _autoreset;
        }

        public bool Ellapsed
        {
            get { return ellapsed; }
        }

        public bool AutoReset
        {
            get { return myTimer.AutoReset; }
        }

        public void Start()
        {
            myTimer.Start();
        }

        public void Reset()
        {
            ellapsed = false;
        }

        private void myTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            ellapsed = true;
        }
    }
}
